<?php if($isAjax==0){?>
<script>
$(function(){
$( "#ngaybd,#ngaykt").datepicker({
						 changeMonth: true,
						dateFormat: "dd-mm-yy",
						showOn: "both",
						buttonImage:$('#root').val()+"img/calendar.gif",
						buttonImageOnly: true
						});
$("#nam").datepicker({
	changeYear: true,
	dateFormat: "yy",
	showOn: "both",
	buttonImage:$('#root').val()+"img/calendar.gif",
	buttonImageOnly: true
	});
	$('#namtr').hide();
	$('#theo').change(function (){if($('#theo').val()=='ngay'){$('#ngay').show();$('#namtr').hide();}else{$('#ngay').hide();$('#namtr').show();}});
});
</script>
<div id="tabs">
	<ul>
        <li><?php echo $this->Html->link(__('Thống kê loại sách độc giả mượn', true), array('controller'=>'giaodichmuontras','action' => 'chart')); ?></li>
        <li id="current"><?php echo $this->Html->link(__('Biên lai phạt', true), array('controller'=>'chitietviphams','action' => 'thongkebl')); ?></li>
        <li><?php echo $this->Html->link(__('Sách quá hạn', true), array('controller'=>'giaodichmuontras','action' => 'dsquahan')); ?></li>
	   <li><?php echo $this->Html->link(__('Sách đang mượn', true), array('controller'=>'giaodichmuontras','action' => 'dssachmuon')); ?></li>
	</ul>
    </ul>
 </div>
<div class="index">
<?php echo $form->create('Chitietvipham');?>
<?php echo $form->input('root',array('id'=>'root','type'=>'hidden','value'=>$this->webroot));?>
<?php echo $form->input('theo',array('id'=>'theo','label'=>'Theo','type'=>'select','options'=>array('ngay'=>'Từ ngày Đến ngày','nam'=>'Năm')));?>
<table>
<tr id='ngay'>
<td><?php echo $form->input('ngaybd',array('id'=>'ngaybd','label'=>'Từ','type'=>'text','value'=>(empty($ngaybd)?'':date('d-m-Y',strtotime($ngaybd)))));?></td>
<td><?php echo $form->input('ngaykt',array('id'=>'ngaykt','label'=>'Đến','type'=>'text','value'=>(empty($ngaykt)?'':date('d-m-Y',strtotime($ngaykt)))));?></td>
</tr>
<tr id='namtr'>
<td><?php echo $form->input('nam',array('id'=>'nam','label'=>'Năm','type'=>'text'));?></td>
</tr>
</table>
<?php echo  $js->submit('Thực hiện',array('url'=>array('controller'=>'chitietviphams','action'=>'thongkebl'),'update'=>'#dsbl'))?>
<div id='dsbl'>
<?php echo $this->Html->link(__('Xuất Excel', true), array('controller'=>'chitietviphams','action' => 'thongkexls',$ngaybd,$ngaykt,$nam)); ?>
<table id="tables">
  <tr>
    <th>STT</th> <th>độc giả</th> <th>Ngày</th><th>Hình thức xử phạt</th><th>Mức phạt</th><th>Ghi chú</th>
  </tr>
  <?php $i=0;?>
  <?php foreach ($chitietphats as $chitietvipham):?>
  <tr>
  	<td><?php echo ++$i ?></td>
    <td><?php echo $chitietvipham['Docgia']['maso'].' - ' . $chitietvipham['Docgia']['tennv'];?></td>
    <td><?php echo date('d-m-Y',strtotime($chitietvipham['Bienlaiphat']['ngaylap']))?></td>
    <td><?php echo $chitietvipham['Hinhthucxuphat']['tenhtxp']?></td>
    <td><?php echo number_format($chitietvipham['Chitietvipham']['mucphat'],0,'','.')?></td>
    <td><?php echo $chitietvipham['Chitietvipham']['ghichu']?></td>
  </tr>
  <?php endforeach;?>
</table>
<p>
	<?php
	$this->Paginator->options(array('url' =>array($ngaybd,$ngaykt,$nam)));
	echo $this->Paginator->counter(array(
	'format' => __('Trang %page%/%pages%, hiện có %count% mẫu tin', true)
	));
	?>	</p>

	<div class="paging">
		<?php echo $this->Paginator->prev('<< ' . __('Trước', true), array(), null, array('class'=>'disabled'));?>
	 | 	<?php echo $this->Paginator->numbers();?>
 |
		<?php echo $this->Paginator->next(__('Sau', true) . ' >>', array(), null, array('class' => 'disabled'));?>
	</div>
</div>
<?php }else{?>
<?php if(!empty($chitietphats)){?>
<?php echo $this->Html->link(__('Xuất Excel', true), array('controller'=>'chitietviphams','action' => 'thongkexls',$ngaybd,$ngaykt,$nam)); ?>
<table id="tables">
  <tr>
    <th>STT</th> <th>độc giả</th> <th>Ngày</th><th>Hình thức xử phạt</th><th>Mức phạt</th><th>Ghi chú</th>
  </tr>
  <?php $i=0;?>
  <?php foreach ($chitietphats as $chitietvipham):?>
  <tr>
  	<td><?php echo ++$i ?></td>
    <td><?php echo $chitietvipham['Docgia']['maso'].' - ' . $chitietvipham['Docgia']['tennv'];?></td>
    <td><?php echo date('d-m-Y',strtotime($chitietvipham['Bienlaiphat']['ngaylap']))?></td>
    <td><?php echo $chitietvipham['Hinhthucxuphat']['tenhtxp']?></td>
    <td><?php echo number_format($chitietvipham['Chitietvipham']['mucphat'],0,'','.')?></td>
    <td><?php echo $chitietvipham['Chitietvipham']['ghichu']?></td>
  </tr>
  <?php endforeach;?>
</table>
<p>
	<?php
	$this->Paginator->options(array('url' =>array($ngaybd,$ngaykt,$nam)));
	echo $this->Paginator->counter(array(
	'format' => __('Trang %page%/%pages%, hiện có %count% mẫu tin', true)
	));
	?>	</p>

	<div class="paging">
		<?php echo $this->Paginator->prev('<< ' . __('Trước', true), array(), null, array('class'=>'disabled'));?>
	 | 	<?php echo $this->Paginator->numbers();?>
 |
		<?php echo $this->Paginator->next(__('Sau', true) . ' >>', array(), null, array('class' => 'disabled'));?>
	</div>
<?php }else{?><h2>Không có dữ liệu</h2> <?php }}?>
</div>